﻿﻿package test {
	import extremefx.events.EventArgs;
	import extremefx.geom.Size;
	import extremefx.storage.LoadQeue;
	import extremefx.ui.Container;
	import extremefx.ui.DragDockPanel;
	import extremefx.ui.StyleManager;
	import extremefx.ui.UIStage;
	import extremefx.ui.layout.DragDockLayout;
	
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.events.Event;
	
	/*FDT_IGNORE*/
	import gpi.skin.arrowDown;
	/*FDT_IGNORE*/
	
	/**
	 * @author Marcelo Volmaro
	 */
	 
	[Frame(factoryClass="extremefx.Preloader")];
	public class DragDockPanelsTest extends Sprite {
		private var _loader:LoadQeue;
		private var _cont:Container;

		public function main():void {
			UIStage.init(this.stage);
			
			_loader = new LoadQeue();
			StyleManager.init(_loader);
			_loader.onQeueComplete.add(doWork);
/*FDT_IGNORE*/
//includes the skin assets...
			var a:gpi.skin.arrowDown;
			var b:gpi.skin.arrowLeft;
			var c:gpi.skin.arrowRight;
			var d:gpi.skin.arrowUp;
			var e:gpi.skin.buttons;
			var f:gpi.skin.buttonTabFocus;
			var g:gpi.skin.checkbox;
			var h:gpi.skin.dropDown;
			var i:gpi.skin.genericTabFocus;
			var j:gpi.skin.hScrollBar;
			var k:gpi.skin.hThumb;
			var l:gpi.skin.input;
			var m:gpi.skin.inputBackground;
			var n:gpi.skin.itemList;
			var o:gpi.skin.itemListBack;
			var p:gpi.skin.listItem;
			var q:gpi.skin.radio;
			var r:gpi.skin.vScrollBar;
			var s:gpi.skin.vThumb;
/*FDT_IGNORE*/	
		}
		
		private function doWork(pSender:LoadQeue, pArgs:EventArgs):void {
			var stage:Stage = UIStage.STAGE;
			stage.addEventListener(Event.RESIZE, resizeStage);
			
			var c:Container = _cont = new Container();
			c.attachToDisplay(UIStage.ROOT);
			
			var ddl:DragDockLayout = new DragDockLayout();
			ddl.hMargin = 4;
			ddl.vMargin = 4;
			
			c.layoutManager = ddl;

			c.add(new DragDockPanel());
			c.add(new DragDockPanel());
			c.add(new DragDockPanel());
			c.add(new DragDockPanel());
			c.add(new DragDockPanel());
			c.add(new DragDockPanel());
			
			resizeStage();
		}
		
		private function resizeStage(event:Event = null):void {
			_cont.size = new Size(stage.stageWidth - 1, stage.stageHeight - 1);
		}
	}
}
